Skip to content

Fetch conflicts after train simulation update#16701

Open
achrafmohye wants to merge 1 commit into
devfrom
ame/fix-conflicts-fetch-before-simulation
Open

Fetch conflicts after train simulation update#16701
achrafmohye wants to merge 1 commit into
devfrom
ame/fix-conflicts-fetch-before-simulation

Conversation

@achrafmohye
Copy link
Copy Markdown
Contributor

Closes #16347

Signed-off-by: achrafmohye <a.mohyeddine@gmail.com>
@github-actions github-actions Bot added the area:front Work on Standard OSRD Interface modules label May 12, 2026
@achrafmohye achrafmohye requested a review from Pivouane May 12, 2026 13:41
@emersion emersion self-requested a review May 12, 2026 13:44
Copy link
Copy Markdown
Contributor

@Pivouane Pivouane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, works fine, thank you 👍

@achrafmohye achrafmohye marked this pull request as ready for review May 15, 2026 07:07
@achrafmohye achrafmohye requested a review from a team as a code owner May 15, 2026 07:07
Copy link
Copy Markdown
Member

@emersion emersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm a bit confused about the approach here.

#16347 is meant to be fixed as a follow-up of #14544 - but it seems like this PR tries to fix it without #14544?

// we don't want to invalidate the train_schedule tags here to prevent multiple calls

getTimetableByIdConflicts: {
providesTags: ['conflicts'],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removes the current tags, ['timetable']. This is an issue because deleteTrainSchedules is not the only request which should invalidate conflicts. For instance, updating a train schedule's path may also result in a new conflict or remove an existing conflict.

(Note, I don't understand why we need a new tag type.)

}).unwrap();

setTrainScheduleDepartureTime(trainScheduleId, newDeparture);
dispatch(osrdEditoastApi.util.invalidateTags(['conflicts']));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is doing manually something that rtk-query should be doing automatically. Do we have a good reason to do so?

if (onProgressRef.current) onProgressRef.current(summaries);
if (loader.pending.length === 0) {
setAllSimulationsDone(true);
dispatch(osrdEditoastApi.util.invalidateTags(['conflicts']));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obtaining new simulations shouldn't invalidate any previously fetched conflicts.

Invalidating conflicts means that conflicts have changed. Obtaining simulations doesn't mutate any train schedule, so that can't invalidate conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:front Work on Standard OSRD Interface modules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Front tries to load conflicts before simulation when updating a train schedule

3 participants